program binary;
Uses sysutils;

var input:string;
var value,base,current,index,j:longint;
begin
	Writeln ('The time is : ',TimeToStr(Time));
	writeln('Input base');
	readln(base);
	writeln('Input number');
	readln(input);
	for j:=0 to 10000000 do begin


	value := 0;
	for index:=1 to length(input) do begin
		value := value * base;
		value := value + integer(input[index])-integer('0');
	end;
	
	end;
	writeln(value);
	
	Writeln ('The time is : ',TimeToStr(Time));

end.